﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Test.DataAccess.POCO;

namespace Test.IServices
{
    public enum ConfigurationSource
    {
        AppSetting,
        Database
    }

    public interface IConfigurationService : IBaseService<Configuration>
    {
        /// <summary>
        /// 获取配置信息，数据库中的同名配置，将覆盖AppSetting的
        /// </summary>
        string GetByKey(string key);

        /// <summary>
        /// 获取配置信息，数据库中的同名配置，将覆盖AppSetting的，转换为置顶类型
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="key"></param>
        /// <returns></returns>
        T GetByKey<T>(string key);

        /// <summary>
        /// 缓存所有配置，包括AppSetting中的和数据库中的
        /// </summary>
        /// <param name="refresh">强制刷新缓存</param>
        /// <returns>缓存的数据</returns>
        Dictionary<string, string> GetCacheConfiguration(bool refresh = false);
    }
}
